<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery.js"></script>
    <style>
        span{
            display: inline-block;
            width: 100px;
        }
        input{
            display: inline-block;
        }
    </style>

</head>

<span>图片地址:</span><input type="text"><br>
<span>名称:</span><input type="text"><br>
<span> 价格:</span><input type="text"><br>
<span> 描述:</span><input type="text"><br>
<!-- <span>用户id:</span><input type="text"><br> -->
<button>上传商品</button><button>删除商品</button>

<body>
    <script>
        $(function () {

            //上传数据：到 用户"38306"
            $("button").click(function () {
                $.ajax({
                    url: "http://jx.xuzhixiang.top/ap/api/goods/goods-add.php",
                    type: "post",
                    data: {
                        pimg: $("input").eq(0).val(),
                        pname: $("input").eq(1).val(),
                        pprice: $("input").eq(2).val(),
                        pdesc: $("input").eq(3).val(),
                        uid:"38306",
                    },
                    success: function (data) {
                        console.log(data);
                    }
                })
            });

   /*          
    //删除商品


    $("button").eq(1).click(function(){
        let token=JSON.parse(localStorage.getItem("token"));
        console.log(token);
        $.ajax({
            url:"http://jx.xuzhixiang.top/ap/api/goods/goods-delete.php",
             type:"get",
            data:{
                uid: $("input").eq(4).val(),
                token:token,
            },
            success:function(data){
                console.log(data);
            }
        });
    }); */
        




        })
    </script>

</body>

</html>